﻿using System;
using System.Windows.Forms;

namespace TransporteAgua
{
	public partial class frmBuscar : Form
	{
		frmPrincipal parent;
		Database datos;
		string tabla;

		public frmBuscar(Database db, frmPrincipal dad)
		{
			InitializeComponent();
			Owner = dad;
			parent = dad as frmPrincipal;
			datos = db;
		}
		public void buscarPor(string tabla) {
			this.tabla = tabla;
			Text = "Busqueda rapida de " + tabla;
			Show(parent);
			Focus();
		}

		private void btnBuscar_Click(object sender, EventArgs e)
		{
			string filtro = "nombre LIKE '%" + txtBuscar.Text + "%' OR domicilio LIKE '%" + txtBuscar.Text + "%' OR telefono LIKE '%"+txtBuscar.Text+"%'";
			datos.contar(tabla,filtro);
		}
	}
}
